package com.ham.mud.commands.spells.utility;

import com.ham.mud.ServerConnection;
import com.ham.mud.characters.player.Player;
import com.ham.mud.commands.spells.Spell;
import com.ham.mud.items.Item;
import com.ham.mud.items.ItemService;
import com.ham.mud.rooms.Room;
import com.ham.mud.rooms.RoomService;

/**
 * Created by hlucas on Jul 6, 2011 at 10:51:39 AM
 */
public class ContinualLightSpell extends Spell {
    @Override
    public int getManaCost() {
        return 10;
    }

    @Override
    public void castSpell(ServerConnection connection, String target) {
        Player player = connection.getPlayer();
        Room room = RoomService.getRoom(player.getZone(), player.getAtX(), player.getAtY());
        room.printToOthers(player.getName() + " casts continual light and a torch falls to the floor.", connection);
        connection.printSolo("You twiddle your thumbs and a torch appears.");
        Item torch = ItemService.getItem("torch");
        room.addItem(torch);
    }

    @Override
    public String getName() {
        return "Continual Light";
    }
}
